#pragma once

// CVarietySettingDlg dialog
struct PersistVariety;

class CVarietySettingDlg : public CDialog
{
	DECLARE_DYNAMIC(CVarietySettingDlg)

	struct VarietyControls
	{
		CStatic code;
		CEdit minPriceUnit;
		CEdit multiple;
		CEdit marginRate;
		CEdit percentOpenCharge;
		CEdit percentOffsetTodayCharge;
		CEdit percentOffsetCharge;
		CEdit fixedOpenCharge;
		CEdit fixedOffsetTodayCharge;
		CEdit fixedOffsetCharge;
	};

public:
	CVarietySettingDlg(std::vector<PersistVariety>& varietys);   // standard constructor
	virtual ~CVarietySettingDlg();

// Dialog Data
	enum { IDD = IDD_VARIETY_SETTING_DLG };

protected:
	afx_msg void OnBnClickedOk();

	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual BOOL OnInitDialog();

	void DisablePercentChargeControls(char const* prefix, VarietyControls* control);
	VarietyControls* CreateVarietyControls(PersistVariety const& variety, RECT controlRect, int startId);
	bool Validate();
	DECLARE_MESSAGE_MAP()

private:
	std::vector<PersistVariety>& m_varietys;

	std::vector<std::tr1::shared_ptr<VarietyControls>> m_varietyControls;

	std::vector<std::string> m_percentVarietyPrefix;
};
